package org.clockworkmages.games.anno1186.generator.sets;

import org.clockworkmages.games.anno1186.DamageConstants;
import org.clockworkmages.games.anno1186.dao.GameObjectsList;
import org.clockworkmages.games.anno1186.dao.ImageIconDescriptor;
import org.clockworkmages.games.anno1186.generator.GameObjectGenerator;
import org.clockworkmages.games.anno1186.model.Fetish;
import org.clockworkmages.games.anno1186.model.FetishConstants;
import org.clockworkmages.games.anno1186.model.character.Mutation;
import org.clockworkmages.games.anno1186.model.character.Skill;
import org.clockworkmages.games.anno1186.model.character.SkillConstants;
import org.clockworkmages.games.anno1186.model.character.Stat;
import org.clockworkmages.games.anno1186.model.character.StatConstants;
import org.clockworkmages.games.anno1186.model.effect.Condition;
import org.clockworkmages.games.anno1186.model.effect.ConditionConstanst;
import org.clockworkmages.games.anno1186.model.effect.Effect;
import org.clockworkmages.games.anno1186.model.effect.Perk;
import org.clockworkmages.games.anno1186.model.item.EquipmentSlot;
import org.clockworkmages.games.anno1186.model.item.ItemConstants;
import org.clockworkmages.games.anno1186.model.option.GenericOption;
import org.clockworkmages.games.anno1186.model.situation.GenericSituation;
import org.clockworkmages.games.anno1186.scripting.tools.EffectBuilder;
import org.clockworkmages.games.anno1186.scripting.tools.ScriptBuilder;

public class BaseObjects
		extends GameObjectGenerator implements StatConstants, SkillConstants,
		TechnicalSituationConstants, ItemConstants, DamageConstants,
		FetishConstants {

	public String getFileName() {
		return "base";
	}

	@Override
	public GameObjectsList generate() {
		GameObjectsList gameData = new GameObjectsList();
		gameData.getIcons().add(
				new ImageIconDescriptor("none", "images/icons/none.png"));
		gameData.getIcons().add(
				new ImageIconDescriptor("up", "images/icons/up.png"));
		gameData.getIcons().add(
				new ImageIconDescriptor("down", "images/icons/down.png"));
		gameData.getIcons().add(
				new ImageIconDescriptor("in", "images/icons/in.png"));
		gameData.getIcons().add(
				new ImageIconDescriptor("out", "images/icons/out.png"));
		gameData.getIcons().add(
				new ImageIconDescriptor("west", "images/icons/west.png"));
		gameData.getIcons().add(
				new ImageIconDescriptor("east", "images/icons/east.png"));
		gameData.getIcons().add(
				new ImageIconDescriptor("north", "images/icons/north.png"));
		gameData.getIcons().add(
				new ImageIconDescriptor("south", "images/icons/south.png"));
		gameData.getIcons().add(
				new ImageIconDescriptor("fight", "images/icons/fight.png"));
		gameData.getIcons().add(
				new ImageIconDescriptor("sleep", "images/icons/sleep.png"));
		gameData.getIcons().add(
				new ImageIconDescriptor("trade", "images/icons/trade.png"));
		gameData.getIcons().add(
				new ImageIconDescriptor("talk", "images/icons/talk.png"));
		gameData.getIcons().add(
				new ImageIconDescriptor("back", "images/icons/back.png"));

		gameData.getStats().add(new Stat(STRENGTH, "Strength"));
		gameData.getStats().add(new Stat(ENDURANCE, "Endurance"));
		gameData.getStats().add(new Stat(AGILITY, "Agility"));
		gameData.getStats().add(new Stat(CHARM, "Charm"));
		gameData.getStats().add(new Stat(PERCEPTION, "Perception"));
		gameData.getStats().add(new Stat(INTELLIGENCE, "Intelligence"));
		gameData.getStats().add(new Stat(WILLPOWER, "Willpower"));
		//
		gameData.getStats().add(new Stat(REPUTATION, "Reputation"));
		gameData.getStats().add(new Stat(VIRTUE, "Virtue"));
		//
		gameData.getStats()
				.add(new Stat("STATUS_CRIMINALS", "Criminals", true));

		gameData.getSkills().add(new Skill("BODYBUILDING", "Bodybuilding"));
		gameData.getSkills().add(
				new Skill("BARTER", "Barter", CHARM, REPUTATION));
		gameData.getSkills().add(new Skill("MEDITATION", "Meditation"));
		gameData.getSkills().add(
				new Skill("ALCHEMY", "Alchemy", 0.5, INTELLIGENCE));
		gameData.getSkills().add(new Skill("SMITHING", "Smithing", STRENGTH));
		gameData.getSkills().add(
				new Skill("SURVIVAL", "Survival", PERCEPTION, AGILITY));
		gameData.getSkills().add(
				new Skill("SPEECH", "Speech", CHARM, REPUTATION));
		gameData.getSkills().add(
				new Skill("STEALTH", "Stealth", PERCEPTION, AGILITY));
		//
		gameData.getSkills().add(new Skill("BLUDGEON", "Bludgeon"));
		gameData.getSkills().add(new Skill("SWORD", "Sword"));
		gameData.getSkills().add(new Skill("DAGGER", "Dagger"));
		gameData.getSkills().add(new Skill("AXE", "Axe"));
		gameData.getSkills().add(new Skill("POLEARM", "Polearm"));

		Skill skill = new Skill("UNARMED", "Unarmed", AGILITY, STRENGTH);
		skill.getEffects().add(
				EffectBuilder
						.me()
						.modifyDamage(PHYSICAL, ScriptBuilder.LEVEL + "/2",
								ScriptBuilder.LEVEL + "/2").iff().me()
						.isUnarmed().compileEffect());
		gameData.getSkills().add(skill);
		//
		gameData.getSkills().add(
				new Skill("HISTORY", "History", 0.5, INTELLIGENCE));
		gameData.getSkills().add(
				new Skill("THEOLOGY", "Theology", 0.5, INTELLIGENCE));
		gameData.getSkills().add(
				new Skill("DEMONOLOGY", "Demonology", 0.5, INTELLIGENCE));
		gameData.getSkills().add(
				new Skill(INTERROGATION, "Interrogation", WILLPOWER));

		Mutation mutation = new Mutation(
				"GOAT_HOOVES",
				"Goat's hooves",
				EQUIPMENT_SLOT_SHOES,
				"Your legs are covered with thick black fur like that of an animal, and instead of human feet you have a pair of hooves like a goat's. You won't be putting any shoes on those but then again, hey, who needs shoes if they have hooves!",
				false);
		gameData.getMutations().add(mutation);

		EquipmentSlot equipmentSlot = new EquipmentSlot();
		equipmentSlot.setId(EQUIPMENT_SLOT_HEAD);
		equipmentSlot
				.setDescription("On your head you wear ${item.shortDescription}.");
		gameData.getEquipmentSlots().add(equipmentSlot);

		equipmentSlot = new EquipmentSlot();
		equipmentSlot.setId(EQUIPMENT_SLOT_R_HAND);
		equipmentSlot
				.setDescription("In your right hand you hold ${item.shortDescription}.");
		gameData.getEquipmentSlots().add(equipmentSlot);

		gameData.getBaseEffects().add(
				new Effect("me.modifyDerivate('" + D_MAX_HEALTH
						+ "', 2*me.getEffectiveStat('" + ENDURANCE + "'))"));
		gameData.getBaseEffects().add(
				new Effect("me.modifyDerivate('" + D_MAX_STAMINA
						+ "', me.getEffectiveStat('" + ENDURANCE
						+ "')+me.getEffectiveStat('" + WILLPOWER + "'))"));
		gameData.getBaseEffects().add(
				new Effect("me.modifyDerivate('" + D_ACCURACY
						+ "', 1*me.getEffectiveStat('" + AGILITY + "'))"));
		gameData.getBaseEffects().add(
				new Effect("me.modifyDerivate('" + D_EVASION
						+ "', 1*me.getEffectiveStat('" + AGILITY + "'))"));
		gameData.getBaseEffects().add(
				new Effect("me.modifyDerivate('" + D_EXPERIENCE_MODIFIER
						+ "', 1+me.getEffectiveStat('" + INTELLIGENCE
						+ "'))/100"));

		Perk perk;
		perk = new Perk();
		perk.setId("CHANNELER");
		perk.setName("Channeler");
		perk.setDescription("All spells you cast cost 25% less fatigue.");
		perk.getEffects().add(
				new Effect("me.modifyStat(\'" + SPELL_COST_REDUCTION
						+ "\', 25)"));
		gameData.getPerks().add(perk);

		Effect effect;

		Condition condition;
		condition = new Condition();
		condition.setName("Tired");
		condition
				.setDescription("You are very tired, which makes it difficult for you to fight. Try taking a rest or go to sleep.");
		condition.setId(ConditionConstanst.TIRED);
		condition.setCombatOnly(true);
		gameData.getConditions().add(condition);
		effect = EffectBuilder.NEW().me().modifyDerivatePerc(D_ACCURACY, -30)
				.compileEffect();
		effect = EffectBuilder.NEW().me().modifyDerivatePerc(D_EVASION, -30)
				.compileEffect();
		condition.getEffects().add(effect);

		condition = new Condition();
		condition.setName("Satisfied");
		condition
				.setDescription("You feel satisfied, optimistic and ready for adventure! All experience you gain is increased by 25%");
		condition.setId(ConditionConstanst.SATISFIED);
		condition.setCombatOnly(true);
		gameData.getConditions().add(condition);
		effect = EffectBuilder.NEW().me()
				.modifyDerivatePerc(D_EXPERIENCE_MODIFIER, 25).compileEffect();
		condition.getEffects().add(effect);

		gameData.getFetishes()
				.add(new Fetish(MEN, "Sex with men",
						"You like having sex with men, or at least don't mind."));
		gameData.getFetishes()
				.add(new Fetish(WOMEN, "Sex with women",
						"You like having sex with women, or at least don't mind."));
		gameData.getFetishes()
				.add(new Fetish(
						MYTHICAL,
						"Mythical creatures (orcs, werewolves, harpies, mermaids, giants... ",
						"You like to sexually fantasize about fantasy creatures like orcs, harpies, satyrs or mermaids."));
		gameData.getFetishes()
				.add(new Fetish(DOMINATION, "Domination",
						"You like to brutally dominate and humiliate your sexual partners."));
		gameData.getFetishes()
				.add(new Fetish(SUBMISSION, "Submission",
						"You like to be humiliated and brutally dominated by your sexual partners."));
		gameData.getFetishes().add(
				new Fetish(ANAL, "Anal sex", "You like anal sex."));
		gameData.getFetishes()
				.add(new Fetish(URINATION, "Watersports/urination",
						"You think urination is a nice addition to some rough sex games."));
		gameData.getFetishes().add(
				new Fetish(FEET, "Feet/boots",
						"You consider feet and boots worship a turnon."));
		gameData.getFetishes()
				.add(new Fetish(
						ALIEN,
						"Alien/hentai",
						"Haing sex with some grotesque monster - a many-limbed demon or an alien monstrosity with tentacles - seem like a cool idea to you."));

		GenericSituation situation = new GenericSituation();
		situation.setClearScreen(false);
		situation.setId(ST_EMPTY_RETURN);
		gameData.getSituations().add(situation);

		GenericOption option = new GenericOption();
		option.setGoBack(true);
		option.setLabel("Next");
		situation.getOptions().add(option);

		return gameData;
	}
}
